﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Linxiao.Utility.Library.RSACryptoService;

namespace Linxiao.Utility.Library.RSACryptoService.Test
{
    /// <summary>
    /// Test RSACryptoService class
    /// </summary>
    public class Program
    {
        static void Main(string[] args)
        {
            //The name of the key container
            string keyContainer = "TestKeyContainer";
            //Whether the key container is at machine-level or user-level
            bool machineLevelKeyStore = true;
            //string to encrypt
            string stringToEncrypt = "123456";
            Console.WriteLine("String To Encrypt: {0}", stringToEncrypt);

            //encrypt the string
            string encryptedString = Linxiao.Utility.Library.RSACryptoService.RSACryptoService.Encrypt(stringToEncrypt,
                                                                                keyContainer, machineLevelKeyStore);
            Console.WriteLine("Encrypted string: {0}", encryptedString);

            //decrypt the string
            string decryptedString = Linxiao.Utility.Library.RSACryptoService.RSACryptoService.Decrypt(encryptedString,
                                                                                keyContainer, machineLevelKeyStore);
            Console.WriteLine("Decrypted string: {0}", decryptedString);

            Console.ReadLine();

        }
    }
}
